package utilsJ2ME.listas;

import cultivameCore.tienda.Negociable;
import cultivameCore.utils.Inventario;
import cultivameCore.utils.ListaString;

public class InventarioJ2ME implements Inventario {
	
	ListaStringJ2ME keys=new ListaStringJ2ME();
	ListaNegociableJ2ME objets=new ListaNegociableJ2ME();

	public void put(String key, Negociable obj) {
		// TODO Auto-generated method stub
		keys.add(key);
		objets.add(obj);
	}

	public Negociable get(String nom) {
		// TODO Auto-generated method stub
		boolean b=false;
		Negociable o=null;
		if(keys.length()>0){
			int i=0;
			while(i<keys.length()&&!b){
				b=keys.get(i).equals(nom);
				i++;
			}
			i--;
			if(b){
				o=objets.get(i);
			}
		}
		return o;
	}

	public ListaString keySet() {
		// TODO Auto-generated method stub
		return (ListaString) keys;
	}

}
